<?php

/**
 * PlanPagoAgua filter form base class.
 *
 * @package    sf_sandbox
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasePlanPagoAguaFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'fecha'               => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'totalinteres'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'totalrecargo'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'valor_cuota'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'periodo_desde'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'cantidad_cuotas'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'estado'              => new sfWidgetFormChoice(array('choices' => array('' => '', 'DEBE' => 'DEBE', 'PAGADO' => 'PAGADO', 'ANULADO' => 'ANULADO'))),
      'obs'                 => new sfWidgetFormFilterInput(),
      'unidad_funcional_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('UnidadFuncional'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'fecha'               => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'totalinteres'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'totalrecargo'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'valor_cuota'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'periodo_desde'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'cantidad_cuotas'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'estado'              => new sfValidatorChoice(array('required' => false, 'choices' => array('DEBE' => 'DEBE', 'PAGADO' => 'PAGADO', 'ANULADO' => 'ANULADO'))),
      'obs'                 => new sfValidatorPass(array('required' => false)),
      'unidad_funcional_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('UnidadFuncional'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('plan_pago_agua_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'PlanPagoAgua';
  }

  public function getFields()
  {
    return array(
      'id'                  => 'Number',
      'fecha'               => 'Date',
      'totalinteres'        => 'Number',
      'totalrecargo'        => 'Number',
      'valor_cuota'         => 'Number',
      'periodo_desde'       => 'Date',
      'cantidad_cuotas'     => 'Number',
      'estado'              => 'Enum',
      'obs'                 => 'Text',
      'unidad_funcional_id' => 'ForeignKey',
    );
  }
}
